home *** CD-ROM | disk | FTP | other *** search
/ EnigmA Amiga Run 1995 October / EnigmA AMIGA RUN 01 (1995)(G.R. Edizioni)(IT)[!][issue 1995-10][Aminet 7].iso / Aminet / comm / tcp / guif1_3.lha / guif1.3 / Guif next >
Text File  |  1995-04-18  |  3KB  |  128 lines

  1. /*********************************************/
  2. /* Andy's third GUI Finger, this time using  */
  3. /* a snazzy little GUI tool called 'AskEnv'  */
  4. /*          written by Bengt Giger.          */
  5. /* ©1995 Andy Aldridge, if you can improve   */
  6. /* on this script please feel free but please*/
  7. /*  send me a copy of the improved script.   */
  8. /*          andy@aald.demon.co.uk            */
  9. /*********************************************/
  10.  
  11.  
  12. /*$VER: GUIF v1.3 (17/04/95)
  13. */
  14. address command
  15.  
  16. /* you may change these if you wish           */
  17.  
  18. configfile = 'Amitcp:db/Guif.config'          /* this is the location of the config file */
  19. reqfile    = 't:finger.req'                   /* this is the temporary file for AskEnv   */
  20. ViewCmd    = 'Sys:Utilities/Multiview'        /* this is used to view the finger output  */
  21.  
  22. /* parse-ing the argument CONFIG which        */
  23. /* will allow you to create a new GUIF.config */
  24.  
  25. parse arg argument
  26.  
  27. /* sort out RexxReqTools and RexxArpLib       */
  28.  
  29. if upper(argument) = 'CONFIG' then
  30.     call fingerconfig
  31.  
  32. call addlib('rexxarplib.library',0,-30)
  33. if exists("libs:rexxreqtools.library")>0 then do
  34.    call addlib('rexxreqtools.library',0,-30)
  35. end
  36. if (exists("libs:rexxreqtools.library")=0) then do
  37.    say 'rexxreqtools is not installed! Install it and try again.'
  38.    exit
  39. end
  40.  
  41. /* check the existance of the GUIF.config file */
  42. /* and create one if it can't be found.        */
  43.  
  44. if ~exists(configfile) then
  45.     do
  46.         call rtezrequest('you have no config file, would you like to make one?','_Yes |_No','GUIF v1.3','rt_reqpos = reqpos_centerscr')
  47.         frt = rtresult
  48.         if frt = 0 then exit
  49.         call Fingerconfig
  50.     end
  51.  
  52. /* create an 'AskEnv' .req file to be called.  */
  53.  
  54. call open(InpFile,configfile,R)
  55. call open(OutFile,reqfile,W)
  56.  
  57. call writeln(outfile,'WINDOW CENTER 280 190 NAME "GUIF v1.3 "')
  58. call writeln(outfile,'BUTTON POSITION 120 162 40 20 LABEL "Quit" #')
  59.  
  60. COUNT = 20
  61. EnvCnt = 2
  62.  
  63. do forever
  64.     line = readln(InpFile)
  65.     if EOF(InpFile) then break
  66.     if EnvCnt = 10 then break
  67.     if left(line,1) ~= "#" then do
  68.         if compress(line) ~= "" then do
  69.             Call WriteLn(Outfile, 'BUTTON POSITION 30 'Count' 225 15 END LABEL "'line'" #')
  70.             'setenv GUIF_'EnvCnt line
  71.             COUNT = COUNT + 17
  72.  
  73.             EnvCnt = EnvCnt + 1
  74.         end
  75.     end
  76. end
  77. call close(InpFile)
  78. call close(OutFile)
  79.  
  80. /* AskEnv now does it's business...            */
  81.  
  82. do forever
  83.     'AskEnv GADFILE t:finger.req'
  84.     fnum = GetEnv(AskEnv_Button)
  85.     if fnum = 1 then break
  86.     host = GetEnv('GUIF_'fnum)
  87.     call fingerr
  88. end
  89.  
  90. /* Game Over man, delete all the temp files    */
  91.  
  92. 'delete >NIL: t:finger.req'
  93. 'delete >NIL: env:GUIF#?'
  94. 'delete >NIL: t:finger.temp'
  95. exit
  96.  
  97.  
  98. /* routine that calls AmiTCP's Finger command  */
  99. /* and writes it to a temporary file, and then */
  100. /* views this file using the chosen text viewer*/
  101.  
  102. fingerr:
  103. 'Amitcp:bin/Finger >t:Finger.temp 'Host
  104. 'Echo >>t:Finger.temp ""'
  105. ViewCmd 't:finger.temp'
  106. return
  107.  
  108. exit
  109.  
  110. /* routine that creates a GUIF.config file     */
  111.  
  112. fingerconfig:
  113. call open(FinConf,'Amitcp:db/Guif.config',W)
  114. call writeln(FinConf,'# File created by GUIF containing popular finger locations')
  115. count = 0
  116. do forever
  117.     line = rtgetstring(,'Enter finger location','GUIF v1.3',,'rt_reqpos = reqpos_centerscr')
  118.     frt = rtresult
  119.     if frt = 0 then break
  120.     if compress(line) = "" then break
  121.     call writeln(FinConf,line)
  122.     count = count + 1
  123.     if count = 8 then break
  124. end
  125. call close(FinConf)
  126. return
  127.  
  128.